package com.ls.blog.consumer;

import com.ls.blog.entity.Article;
import com.ls.blog.service.ArticleService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@RabbitListener(queues = "articleQueue")
@Component
public class UpCountConsumer {

    @Autowired
    ArticleService articleService;

    @RabbitHandler
    public void process(Article article){
        articleService.updateById(article);
    }
}
